
<html>
<head>
<script type="text/javascript">
var val = "";
	function displayResult() {
		
		var i = 0;
		var x = document.getElementById("id").checked;
		var y = document.getElementById("mid").checked;
		var z = document.getElementById("processName").checked;
		var a = document.getElementById("pid").checked;
		var b = document.getElementById("workingSetSize").checked;
		for (i = 0; i < 5; i++) {
			if (x == true) {
				val = val + document.getElementById("id").value + ",";
				//alert(val);
				x=false;
			}
			if (y == true) {
				val = val + document.getElementById("mid").value + ",";
				//alert(val);
				y=false;
			}
			if (z == true) {
				val = val + document.getElementById("processName").value + ",";
				//alert(val);
				z=false;
			}
			if (a == true) {
				val = val + document.getElementById("pid").value + ",";
				//alert(val);
				a=false;
			}
			if (b == true) {
				val = val + document.getElementById("workingSetSize").value + ",";
				//alert(val);
				b=false;
			}
			
		}
		//val = val + "p";
		alert(val);	
		var url="http://localhost:8080/pdf/res/helloworld?json=" + val;
		
		sendRequest(url);
		
		sendRequest('file.pdf',handleRequest);
	}
		
			function sendRequest(url,callback,postData) {
				var req = createXMLHTTPObject();
				if (!req) return;
				var method = (postData) ? "POST" : "GET";
				req.open(method,url,true);
				req.setRequestHeader('User-Agent','XMLHTTP/1.0');
				if (postData)
					req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
				req.onreadystatechange = function () {
					if (req.readyState != 4) return;
					if (req.status != 200 && req.status != 304) {
						alert('HTTP error ' + req.status);
						return;
					}
					callback(req);
				}
				if (req.readyState == 4) return;
				req.send(postData);
				
				//alert(req.responseText);
			}

			var XMLHttpFactories = [
				function () {return new XMLHttpRequest()},
				function () {return new ActiveXObject("Msxml2.XMLHTTP")},
				function () {return new ActiveXObject("Msxml3.XMLHTTP")},
				function () {return new ActiveXObject("Microsoft.XMLHTTP")}
			];

			function createXMLHTTPObject() {
				var xmlhttp = false;
				for (var i=0;i<XMLHttpFactories.length;i++) {
					try {
						xmlhttp = XMLHttpFactories[i]();
					}
					catch (e) {
						continue;
					}
					break;
				}
				return xmlhttp;
			}

			function handleRequest(req) {
				var writeroot = [some element];
				writeroot.innerHTML = req.responseText;
			}
		
		
		
		
	
</script>
</head>
<body>

	<form>
		<input type="checkbox" id="id" value="id" />id<br /> <input
			type="checkbox" id="mid" value="mid" />mid<br /> <input
			type="checkbox" id="processName" value="processName" />processName<br />
		<input type="checkbox" id="pid" value="pid" />pid<br /> <input
			type="checkbox" id="workingSetSize" value="workingSetSize" />workingSetSize<br />
	</form>

	<button type="button" onclick="displayResult()">Display value</button>


	<a href="http://localhost:8080/pdf/res/helloworld"> pdf</a>

</body>
</html>

